package cn.edu.scau.cmi.yewangjiang.singleton;

public class Marshal {
    private static int objectNumber=0;
    private static final int MAX_OBJECT=10;
    private static Marshal marshals[]=new Marshal[10];
    private String name;
    private Marshal(String name) {
    	this.name=name;
    }
    public static Marshal getMarshal(String name) {
    	if(objectNumber<10) {
    		marshals[objectNumber]=new Marshal(name);
    		objectNumber++;
    	}
    	return marshals[objectNumber-1];
    }
    public int getObjectNumber() {
    	return objectNumber;
    }
    
}
